package com.blb.ssm.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.blb.ssm.entity.User;

public interface UserMapper {

	@Select("select * from user where username = #{username}")
	User login(String username);

	
	int getcount(@Param("uname")String uname,@Param("username")String username);

	@Select("select * from user where username=#{username}")
	User selectUserByUsername(String username);

	@Insert("insert into user values(#{uid},#{uname},#{username},#{password},#{rolename})")
	void addUser(User user);

	@Delete("delete from user where uid=#{uid}")
	void delUser(String uid);

	
	List<User> getlist(@Param("uname")String uname,@Param("username")String username,@Param("start")int start,@Param("limit")int limit);

	@Update("update user set uname=#{uname},username=#{username},password=#{password},rolename=#{rolename} where uid=#{uid}")
	void updateUser(User user);


	@Select("select uid from user where username=#{username}")
	String selectUserByUID(String username);

}